<script src="/ueditor/ueditor.config.js"></script>
<script src="/ueditor/ueditor.all.min.js"></script>
<script src="/ueditor/lang/zh-cn/zh-cn.js"></script>

<div class="content">
    <form id="add-form" class="form-horizontal nice-validator n-default n-bootstrap" role="form" data-toggle="validator" method="POST" action="" novalidate="novalidate">
        {if condition="$res.title neq ''"}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">父标题:</label>
            <div class="col-xs-12 col-sm-8">
               <span style="margin-top:12px;">{$res.title}</span>
            </div>
        </div>
        {/if}
        <?php if ($_SESSION['think']['admin']['id']==1){?>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">产品信息类别:</label>
            <div class="col-xs-12 col-sm-8">
                <select name="info_type" id="infotype">
                    {volist name="info_type" id="vo" key="k"}
                    <option value="{$k}" data_val="{$vo}">{$vo}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <?php } ?>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">标题:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="title" class="form-control" name="title" value="" type="text">
            </div>
        </div>
       <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">外链地址:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="linkto" class="form-control" name="linkto" type="text">
            </div>
        </div>-->
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">状态:</label>
            <div class="col-xs-12 col-sm-8">
                <input  name="status"  value="0" type="radio" checked="checked">显示
                <input  name="status"  value="1" type="radio">隐藏
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">内容:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea name="info"  id="info"></textarea>
            </div>
        </div>
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="button" class="btn btn-success btn-embossed" onclick="sub();">确定</button>
                <a href="{:url('info_index',array('p_id'=>$pid))}" class="btn btn-default btn-embossed">返回</a>
            </div>
        </div>
    </form>

</div>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
    $("#infotype").change(function(){
        var selectVal=$("#infotype").val();
        var data_val=$("#infotype option:selected").attr("data_val");
        //alert(data_val)
        var title=$("#title").val();
        if(title==''){
            $("#title").val(data_val);
        }

    });
    function sub(){
         var title=$("#title").val();
         if(title==''){
             alert("标题不得为空");
             return;
         }

         $("#add-form").submit();
    }



</script>

<script type="text/javascript">
    UE.getEditor('info', {
        theme:"default", //皮肤
        lang:"zh-cn", //语言
        initialFrameWidth:1078,  //初始化编辑器宽度,默认800
        initialFrameHeight:320//  初始化编辑器高度
    });
</script>
